package cn.congine.wizarpos.mall.action;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import cn.congine.wizarpos.mall.service.impl.WizarposOpenRestClient;


@Controller
@RequestMapping(value = "/ad")
public class AdvertisementAction {
	@Autowired
	private WizarposOpenRestClient wizarposOpenRestClient;
	
	@RequestMapping(value = "/list")
	
	public ModelAndView bankCardList(
			@RequestParam(value = "url", required = true) String url,
			HttpServletRequest httpRequest) {	
		
		Document doc = null;
		try {
			doc = Jsoup.connect(url).get();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		 
		doc.select("script:eq(2)").html().replaceFirst("^var sn = \"\\w\" || \"\";$", "var sn = \"\" || \"\";");
		
		return new ModelAndView("");
	}
}
